package com.kaishengit.dao;


import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.kaishengit.core.dao.BaseDao;
import com.kaishengit.pojo.Employee;
import com.kaishengit.pojo.Product;
import com.kaishengit.pojo.ProductEmployee;

@Repository
public class ProductEmployeeDao extends BaseDao<ProductEmployee, Integer> {

	@SuppressWarnings("unchecked")
	public List<Product> findListByEmp(Employee em) {
		String hql = "from ProductEmployee where employee=? ";
		
		Query query = getSession().createQuery(hql);
		query.setParameter(0, em);
		List<Product> pList = new ArrayList<Product>();
		
		pList = query.list();
		
		System.out.println("plist: " + pList.size() );
		
		return pList;
	}

	

	
}
